package zhuyun.code.launcheractivity.view

import android.os.Bundle
import android.widget.RadioGroup
import kotlinx.android.synthetic.main.activity_main.*
import zhuyun.code.launcheractivity.R
import zhuyun.code.launcheractivity.view.fragment.FollowDynamicFragment
import zhuyun.code.launcheractivity.view.fragment.HomeFragment

class MainActivity : BaseActivity(),RadioGroup.OnCheckedChangeListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        showFragment(R.id.frameLayout,
            HomeFragment()
        )
        bottom.setOnCheckedChangeListener(this)
    }

    override fun onCheckedChanged(group: RadioGroup?, checkedId: Int) {
        when(checkedId){
            R.id.rbHome->{
                showFragment(R.id.frameLayout,HomeFragment())
            }
            R.id.rbFollow->{
                showFragment(R.id.frameLayout,FollowDynamicFragment())
            }

        }
    }
}
